/*
 * @Date: 2022-01-02 21:28:51
 * @LastEditors: xiaole
 * @LastEditTime: 2022-01-03 17:14:26
 */
import React from "react";
import { HashRouter, Route, Switch,Redirect } from "react-router-dom";
import Login from "../views/login/Login";
import NewsSandBox from "../views/sandbox/NewsSandBox.jsx";


export default function IndexRouter() {
    return (
        <HashRouter>
            <Switch>
                <Route path="/login" component={Login} />
                <Route path="/aa" component={NewsSandBox} />
                <Route path="/" render={()=> {
                    // return <NewsSandBox />
                    return localStorage.getItem('token') ? <NewsSandBox /> : <Redirect to="/login" />
                }} />
            </Switch>
        </HashRouter>
    )
}